//
//  BzhiweiListCell.m
//  Ten
//
//  Created by anfuer on 2018/11/15.
//  Copyright © 2018年 xg韦. All rights reserved.
//

#import "BzhiweiListCell.h"
#import "MenuCollCell.h"
#import "ELCVFlowLayout.h"
#import "UIButton+WebCache.h"
@interface BzhiweiListCell()
{
    NSArray*colldata;
}
@end
@implementation BzhiweiListCell

- (void)awakeFromNib {
    [super awakeFromNib];
      [_collview registerClass:[MenuCollCell class] forCellWithReuseIdentifier:@"MenuCollCell"];
    colldata=@[@"五险一金",@"出国旅游",@"每日三餐大鱼大肉",@"大大服务"];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
+ (instancetype)CellWithTableView:(UITableView *)tableView
{
    static NSString *reuseId = @"BzhiweiListCell";
    BzhiweiListCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseId];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"BzhiweiListCell" owner:nil options:nil] lastObject];
        
    }
    
    
    return cell;
    
    
}

-(void)Cellinit:(NSDictionary*)dic
{
    
    
}


#pragma mark -- UICollectionViewDataSource 数据源方法
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
    return CGSizeMake([MyUtils GetWidthFromString:colldata[indexPath.row] Font:[UIFont systemFontOfSize:12] Height:25]+20 ,25);
    
}


- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    
    
    return colldata.count;
    
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *ID = @"MenuCollCell";
    MenuCollCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
    [cell.btno setTitle:colldata[indexPath.row] forState:UIControlStateNormal];
    
    return cell;
}

#pragma mark --UICollectionViewDelegate

-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    
    //    [MyUtils collviewSelidex:name_str toVc:[MyUtils getCurrentVC] andShopInfo:nil];
}

//设置垂直间距,默认的垂直和水平间距都是10
-(CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section
{
    return 5;
}
//设置水平间距
-(CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section
{
    return 5;
}






@end
